#include "MainWindowEventFilter.h"

#include "MainWindow.h"

namespace ui {

MainWindowEventFilter::MainWindowEventFilter(MainWindow *_parent): QObject(_parent->getWidget()),
    parent(_parent) {

}

bool MainWindowEventFilter::eventFilter(QObject *obj, QEvent *event) {
    if(obj == parent->getWidget()) {
        if(event->type() == QEvent::Close) {
            parent->onExit();
        }
    }

    return QObject::eventFilter(obj, event);
}

}
